//
//  MiaoSha_Header_CCell.swift
//  MikerShop
//
//  Created by eme on 2017/2/20.
//  Copyright © 2017年 eme. All rights reserved.
//

/*
 owner:cy
 update:2017年04月10日18:13:09
 info: 图文类->轮播图 cell
 VC :  HomePageVc
 */
import UIKit
import RxSwift
import CommonCore
import RickonCore

class T1_1_CCell: UICollectionViewCell,CyclePictureViewDelegate {
    
    @IBOutlet weak var content_Cpv: CyclePictureView!
    
    var cpImageItem:[T1ListModel]?{
        didSet{
            
            if let list = self.cpImageItem {
                self.content_Cpv.imageURLArray = list.map{$0.pic}
            }
        }
    }
    var didSelectItem_Closure:((_ item:T1ListModel) -> Void)?
    
    override func awakeFromNib() {
        content_Cpv.imageURLArray = []
        content_Cpv.placeholderImage = UIImage(named: "banner-placeholder", in: RobbCore.bundle, compatibleWith: nil)
        content_Cpv.delegate = self
        content_Cpv.pageControlAliment = .CenterBottom
        content_Cpv.currentDotColor = Theme.robb.homePage.currentDotColor
        content_Cpv.otherDotColor = Theme.robb.homePage.otherDotColor
        content_Cpv.detailLableBackgroundColor = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.5)
    }
    
    func cyclePictureView(cyclePictureView: CyclePictureView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
        if let list = self.cpImageItem {
            if list.count > indexPath.row {
                if let didSelectItem_Closure = self.didSelectItem_Closure  {
                    didSelectItem_Closure(list[indexPath.row])
                }
            }
        }
    }
    
}
